﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AutoTrigger
{
    public List<string> _boolCaches = new List<string>();

    private MonoBehaviour mono;
    public AutoTrigger(GameObject gameObject)
    {
        mono = gameObject.GetComponent<MonoBehaviour>();
        mono.StartCoroutine(Update());
    }

    public void SetTrigger(string name)
    {
        if (_boolCaches.Contains(name)) return;
        _boolCaches.Add(name);
    }

    public bool GetTrigger(string name)
    {
        return _boolCaches.Contains(name);
    }
    private IEnumerator Update()
    {
        yield return new WaitForEndOfFrame();
        if (_boolCaches.Count > 0) _boolCaches.Clear();
    }
}